home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
gsdbloo.exe
/
DEMOE002.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-02-24
|
4KB
|
110 lines
program DemoE002;
{------------------------------------------------------------------------------
DBase File Display
Expanded Sample 2
Demo Program
Copyright (c) Richard F. Griffin
10 February 1992
102 Molded Stone Pl
Warner Robins, GA 31088
-------------------------------------------------------------
Display and edit all record fields on-screen. This example also
allows editing of the memo record.
********** Not For Use in a TurboVision Environment **********
If it does not already exist, the DEMOE2.DBF file will be created
by using the MakeTestData procedure in GS_GENF.PAS.
All fields in the dBase record will be displayed on-screen using
the FieldDisplay procedure in GS_dBFld_Objt. They can be modified
and stored back to the dBase file using the FieldAccept procedure.
-------------------------------------------------------------------------------}
uses
CRT,
DOS,
GS_KeyI,
GS_dBFld,
GS_dBase,
GS_FileH,
GS_GenF;
var
MyFile : GS_dBFld_Objt;
CkFile : file;
DumyStr : string;
procedure DisplayRecord;
begin
MyFile.FieldDisplay('LASTNAME','Last Name: ',1,1);
MyFile.FieldDisplay('FIRSTNAME','First Name, Middle Initial: ',1,2);
MyFile.FieldDisplay('STREET','Street Address: ',1,3);
MyFile.FieldDisplay('OFFICE','Building, suite, etc: ',1,4);
MyFile.FieldDisplay('CITY','City: ',1,5);
MyFile.FieldDisplay('STATE','State: ',1,6);
MyFile.FieldDisplay('ZIP','Zip Code: ',1,7);
MyFile.FieldDisplay('TELEPHONE','Telephone Number: ',1,8);
MyFile.FieldDisplay('BIRTHDATE','Date of Birth: ',1,9);
MyFile.FieldDisplay('PAYMENT','Payment Amount: ',1,10);
MyFile.FieldDisplay('PAIDFLAG','Amount Was Paid?: ',1,11);
MyFile.FieldDisplay('RANDOMNUM','Random Number: ',1,12);
MyFile.FieldDisplay('COMMENTS','Comments: ',1,13);
end;
procedure ModifyRecord;
procedure AcceptRec(FieldName, FieldTitle : string; x, y : integer);
begin
DumyStr := MyFile.FieldAccept(FieldName, FieldTitle, x, y);
if not GS_KeyI_Esc then
MyFile.FieldPut(FieldName,DumyStr);
end;
begin
MyFile.RecChanged := false;
AcceptRec('LASTNAME','Last Name: ',1,1);
if not GS_KeyI_Esc then AcceptRec('FIRSTNAME',
'First Name, Middle Initial: ',1,2);
if not GS_KeyI_Esc then AcceptRec('STREET','Street Address: ',1,3);
if not GS_KeyI_Esc then AcceptRec('OFFICE','Building, suite, etc: ',1,4);
if not GS_KeyI_Esc then AcceptRec('CITY','City: ',1,5);
if not GS_KeyI_Esc then AcceptRec('STATE','State: ',1,6);
if not GS_KeyI_Esc then AcceptRec('ZIP','Zip Code: ',1,7);
if not GS_KeyI_Esc then AcceptRec('TELEPHONE','Telephone Number: ',1,8);
if not GS_KeyI_Esc then AcceptRec('BIRTHDATE','Date of Birth: ',1,9);
if not GS_KeyI_Esc then AcceptRec('PAYMENT','Payment Amount: ',1,10);
if not GS_KeyI_Esc then AcceptRec('PAIDFLAG','Amount Was Paid?: ',1,11);
if not GS_KeyI_Esc then AcceptRec('RANDOMNUM','Random Number: ',1,12);
if not GS_KeyI_Esc then AcceptRec('COMMENTS','Comments: ',1,13);
if (not GS_KeyI_Esc) and (MyFile.RecChanged) then
MyFile.PutRec(MyFile.RecNumber);
end;
begin
ClrScr;
if not GS_FileExists(CkFile,'DEMOE2.DBF') then
begin
writeln('Creating DemoE2.DBF');
MakeTestData('DemoE2', 20, true);
writeln('DemoE2.DBF Created');
ClrScr;
end;
GotoXY(1,15);
write('Press ESC to stop, any other key to continue');
MyFile.Init('DemoE2');
MyFile.Open;
MyFile.GetRec(Top_Record);
while (not MyFile.File_EOF) and (not GS_KeyI_Esc) do
begin
DisplayRecord;
ModifyRecord;
MyFile.GetRec(Next_Record);
end;
MyFile.Close;
end.